//
//  GameComponent.h
//  Components
//
//  Created by Jeppe Nielsen on 3/6/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#pragma once//
#include "IGameComponent.hpp"

namespace Typhoon {
	class GameObject;
    template <class T>
    class GameComponent : public IGameComponent {
    public:
		GameObject* gameObject;
        static const int GetIndex();
    protected:
        static int id;
        static bool isSet;
        GameComponent();
        ~GameComponent();
    };
}

template<class T>
Typhoon::GameComponent<T>::GameComponent() {}

template<class T>
Typhoon::GameComponent<T>::~GameComponent() {}

template<class T>
int Typhoon::GameComponent<T>::id = 0;

template<class T>
bool Typhoon::GameComponent<T>::isSet = false;

template<class T>
const int Typhoon::GameComponent<T>::GetIndex() {
    if (!isSet) {
        isSet = true;
        id = Typhoon::IGameComponent::idCounter++;
    }
    return id;
}



